Method of encoding video data

ABSTRACT

A method of decoding video data in uni-directional prediction by a decoding apparatus can include deriving, by the decoding apparatus, a reference picture index and a motion vector of a current prediction unit; generating, by the decoding apparatus, a prediction block of the current prediction unit using the reference picture index and the motion vector; generating, by the decoding apparatus, a quantized block by inversely scanning quantized coefficient components; generating, by the decoding apparatus, a transformed block by inversely quantizing the quantized block using a quantization parameter; generating, by the decoding apparatus, a residual block by inversely transforming the transformed block; and generating, by the decoding apparatus, reconstructed pixels using the prediction block and the residual block, in which prediction pixels of the prediction block are generated using an interpolation filter selected based on the motion vector, the interpolation filter being a 7-tap filter if the motion vector indicates a quarter pixel position, the interpolation filter being an 8-tap filter if the motion vector indicates a half pixel position.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.15/481,954 filed on Apr. 7, 2017, which is a continuation of U.S. patentapplication Ser. No. 14/692,680 filed on Apr. 21, 2015 (now U.S. Pat.No. 9,648,343 issued May 9, 2017), which is a continuation of U.S.patent application Ser. No. 14/618,833 filed on Feb. 10, 2015 (now U.S.Pat. No. 9,351,012 issued May 24, 2016), which is a continuation of U.S.patent application Ser. No. 14/349,979 filed on Apr. 4, 2014 (now U.S.Pat. No. 8,982,957 issued Mar. 17, 2015), which is a National Stage ofInternational Patent Application No. PCT/CN2012/084018 filed on Nov. 2,2012, which claims priority to Korean Patent Application No.10-2011-0115348 filed on Nov. 7, 2011. The contents of all of theseapplications are hereby incorporated by reference as fully set forthherein in their entirety.

BACKGROUND OF THE INVENTION Field of the Invention

The present invention relates to a method of decoding video data, andmore particularly, to a method of deriving motion information in mergemode by constructing a merge candidate list using spatial and temporalmerge candidates and generating a prediction block using the motioninformation.

Discussion of the Related Art

Methods for compressing video data include MPEG-2, MPEG-4 andH.264/MPEG-4 AVC. According to these methods, one picture is dividedinto macroblocks to encode an image, the respective macroblocks areencoded by generating a prediction block using inter prediction or intraprediction. The difference between an original block and the predictionblock is transformed to generate a transformed block, and thetransformed block is quantized using a quantization parameter and one ofa plurality of predetermined quantization matrices. The quantizedcoefficient of the quantized block are scanned by a predetermined scantype and then entropy-coded. The quantization parameter is adjusted permacroblock and encoded using a previous quantization parameter.

In H.264/MPEG-4 AVC, motion estimation is used to eliminate temporalredundancy between consecutive pictures. To detect the temporalredundancy, one or more reference pictures are used to estimate motionof a current block, and motion compensation is performed to generate aprediction block using motion information. The motion informationincludes one or more reference picture indexes and one or more motionvectors.

According to the H.264/MPEG-4 AVC, only the motion vectors are predictedand encoded using neighboring motion vectors, and the reference pictureindexes are encoded without neighboring reference picture indexes. Also,the computational complexity for generating a prediction block is highbecause the prediction block is interpolated using a long-tap filter.

However, if various sizes are used for inter prediction, the correlationbetween motion information of a current block and motion information ofone or more neighboring block increases. The correlation between motionvector of a current block and motion vector of neighboring block withina reference picture becomes higher as the picture size becomes larger ifmotion of image is almost constant or slow. Accordingly, theconventional compression method described above decreases compressionefficiency of motion information if the picture size is larger than thatof high-definition picture and various sizes are allowed for motionestimation and motion compensation.

SUMMARY OF THE INVENTION

The present invention is directed to a method of decoding video data byderiving motion information by constructing a merge candidate list usingspatial merge candidates and temporal candidate and generatingprediction block using a filter determined by the motion vector.

One aspect of the present invention provides a method of decoding videodata, comprising: deriving a reference picture index and a motion vectorof a current prediction unit; generating a prediction block of thecurrent prediction unit using the reference picture index and the motionvector; generating a quantized block by inverse-scanning quantizedcoefficient components; generating a transformed block byinverse-quantizing the quantized block using a quantization parameter;generating a residual block by inverse-transforming the transformedblock; and generating a reconstructed pixels using the prediction blockand the residual block. Prediction pixels of the prediction block isgenerated using an interpolation filter selected based on the motionvector.

A method according to the present invention derives a reference pictureindex and a motion vector of a current prediction unit, generates aprediction block of the current prediction unit using the referencepicture index and the motion vector, generating a residual block byinverse-scan, inverse-quantization and inverse transform, and generatesreconstructed pixels using the prediction block and the residual block.Prediction pixels of the prediction block is generated using aninterpolation filter selected based on the motion vector. Accordingly,the coding efficiency of the motion information is improved by includingvarious merge candidates. Also, the computational complexity of anencoder and a decoder is reduced by selecting different filter accordingto location of the prediction pixels determined by the motion vector.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an image coding apparatus according to thepresent invention.

FIG. 2 is a flow chart illustrating a method of encoding video data inan inter prediction mode according to the present invention.

FIG. 3 is a conceptual diagram illustrating pixel positions indicated bya motion vector according to the present invention.

FIG. 4 is a flow chart illustrating a method of encoding motioninformation in a merge mode according to the present invention.

FIG. 5 is a conceptual diagram illustrating positions of spatial mergecandidate blocks according to the present invention.

FIG. 6 is a conceptual diagram illustrating positions of spatial mergecandidate blocks in an asymmetric partitioning mode according to thepresent invention.

FIG. 7 is another conceptual diagram illustrating positions of spatialmerge candidate blocks in another asymmetric partitioning mode accordingto the present invention.

FIG. 8 is another conceptual diagram illustrating positions of spatialmerge candidate blocks in another asymmetric partitioning mode accordingto the present invention.

FIG. 9 is another conceptual diagram illustrating positions of spatialmerge candidate blocks in another asymmetric partitioning mode accordingto the present invention.

FIG. 10 is a conceptual diagram illustrating position of temporal mergecandidate block according to the present invention.

FIG. 11 is a conceptual diagram illustrating a method of storing motioninformation according to the present invention.

FIG. 12 is a block diagram of an image decoding apparatus 200 accordingto the present invention.

FIG. 13 is a flow chart illustrating a method of decoding an image ininter prediction mode according to the present invention.

FIG. 14 is a flow chart illustrating a method of deriving motioninformation in merge mode.

FIG. 15 is a flow chart illustrating a procedure of generating aresidual block in inter prediction mode according to the presentinvention.

DETAILED DESCRIPTION OF THE INVENTION

Hereinafter, various embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.However, the present invention is not limited to the exemplaryembodiments disclosed below, but can be implemented in various types.Therefore, many other modifications and variations of the presentinvention are possible, and it is to be understood that within the scopeof the disclosed concept, the present invention may be practicedotherwise than as has been specifically described.

An image encoding apparatus and an image decoding apparatus according tothe present invention may be a user terminal such as a personalcomputer, a personal mobile terminal, a mobile multimedia player, asmartphone or a wireless communication terminal. The image encodingdevice and the image decoding device may be include a communication unitfor communicating with various devices, a memory for storing variousprograms and data used to encode or decode images.

FIG. 1 is a block diagram of an image coding apparatus 100 according tothe present invention.

Referring to FIG. 1, the image coding apparatus 100 according to thepresent invention includes a picture division unit 110, an intraprediction unit 120, an inter prediction unit 130, a transform unit 140,a quantization unit 150, a scanning unit 160, an entropy coding unit170, an inverse quantization/transform unit 180, a post-processing unit190 and a picture storing unit 195.

The picture division unit 110 divides a picture or a slice into plurallargest coding units (LCUs), and divides each LCU into one or morecoding units. The size of LCU may be 32×32, 64×64 or 128×128. Thepicture division unit 110 determines prediction mode and partitioningmode of each coding unit.

An LCU includes one or more coding units. The LCU has a recursive quadtree structure to specify a division structure of the LCU. Parametersfor specifying the maximum size and the minimum size of the coding unitare included in a sequence parameter set. The division structure isspecified by one or more split coding unit flags (split_cu_flags). Thesize of a coding unit is 2N×2N. If the size of the LCU is 64×64 and thesize of a smallest coding unit (SCU) is 8×8, the size of the coding unitmay be 64×64, 32×32, 16×16 or 8×8.

A coding unit includes one or more prediction units. In intraprediction, the size of the prediction unit is 2N×2N or N×N. In interprediction, the size of the prediction unit is specified by thepartitioning mode. The partitioning mode is one of 2N×2N, 2N×N, N×2N andN×N if the coding unit is partitioned symmetrically. The partitioningmode is one of 2N×nU, 2N×nD, nL×2N and nR×2N if the coding unit ispartitioned asymmetrically. The partitioning modes are allowed based onthe size of the coding unit to reduce complexity of hardware. If thecoding unit has a minimum size, the asymmetric partitioning is notallowed. Also, if the coding unit has the minimum size, N×N partitioningmode may not be allowed.

A coding unit includes one or more transform units. The transform unithas a recursive quad tree structure to specify a division structure ofthe coding unit. The division structure is specified by one or moresplit transform unit flags (split_tu_flags). Parameters for specifyingthe maximum size and the minimum size of the luma transform unit areincluded in a sequence parameter set.

The intra prediction unit 120 determines an intra prediction mode of acurrent prediction unit and generates a prediction block using the intraprediction mode.

The inter prediction unit 130 determines motion information of a currentprediction unit using one or more reference pictures stored in thepicture storing unit 195, and generates a prediction block of theprediction unit. The motion information includes one or more referencepicture indexes and one or more motion vectors.

The transform unit 140 transforms a residual block to generate atransformed block. The residual block has the same size of the transformunit. If the prediction unit is larger than the transform unit, theresidual signals between the current block and the prediction block arepartitioned into multiple residual blocks.

The quantization unit 150 determines a quantization parameter forquantizing the transformed block. The quantization parameter is aquantization step size. The quantization parameter is determined perquantization unit. The size of the quantization unit may vary and be oneof allowable sizes of coding unit. If a size of the coding unit is equalto or larger than a minimum size of the quantization unit, the codingunit becomes the quantization unit. A plurality of coding units may beincluded in a quantization unit of minimum size. The minimum size of thequantization unit is determined per picture and a parameter forspecifying the minimum size of the quantization unit is included in apicture parameter set.

The quantization unit 150 generates a quantization parameter predictorand generates a differential quantization parameter by subtracting thequantization parameter predictor from the quantization parameter. Thedifferential quantization parameter is entropy-coded.

The quantization parameter predictor is generated by using quantizationparameters of neighboring coding units and a quantization parameter ofprevious coding unit as follows.

A left quantization parameter, an above quantization parameter and aprevious quantization parameter are sequentially retrieved in thisorder. An average of the first two available quantization parametersretrieved in that order is set as the quantization parameter predictorwhen two or more quantization parameters are available, and when onlyone quantization parameter is available, the available quantizationparameter is set as the quantization parameter predictor. That is, ifthe left and above quantization parameters are available, an average ofthe left and above quantization parameters is set as the quantizationparameter predictor. If only one of the left and above quantizationparameters is available, an average of the available quantizationparameter and the previous quantization parameters is set as thequantization parameter predictor. If both of the left and abovequantization parameters are unavailable, the previous quantizationparameter is set as the quantization parameter predictor. The average isrounded off.

The differential quantization parameter is converted into bins for theabsolute value of the differential quantization parameter and a bin forindicating sign of the differential quantization parameter through abinarization process, and the bins are arithmetically coded. If theabsolute value of the differential quantization parameter is 0, the binfor indicating sign may be omitted. Truncated unary is used forbinarization of the absolute.

The quantization unit 150 quantizes the transformed block using aquantization matrix and the quantization parameter to generate aquantized block. The quantized block is provided to the inversequantization/transform unit 180 and the scanning unit 160.

The scanning unit 160 determines applies a scan pattern to the quantizedblock.

In inter prediction, a diagonal scan is used as the scan pattern ifCABAC is used for entropy coding. The quantized coefficients of thequantized block are split into coefficient components. The coefficientcomponents are significant flags, coefficient signs and coefficientlevels. The diagonal scan is applied to each of the coefficientcomponents. The significant coefficient indicates whether thecorresponding quantized coefficient is zero or not. The coefficient signindicates a sign of non-zero quantized coefficient, and the coefficientlevel indicates an absolute value of non-zero quantized coefficient.

When the size of the transform unit is larger than a predetermined size,the quantized block is divided into multiple subsets and the diagonalscan is applied to each subset. Significant flags, coefficient signs andcoefficients levels of each subset are scanned respectively according tothe diagonal scan. The predetermined size is 4×4. The subset is a 4×4block containing 16 transform coefficients.

The scan pattern for scanning the subsets is the same as the scanpattern for scanning the coefficient components. The significant flags,the coefficient signs and the coefficients levels of each subset arescanned in the reverse direction. The subsets are also scanned in thereverse direction.

A parameter indicating last non-zero coefficient position is encoded andtransmitted to a decoding side. The parameter indicating last non-zerocoefficient position specifies a position of last non-zero quantizedcoefficient within the quantized block. A non-zero subset flag isdefined for each subset other than the first subset and the last subsetand is transmitted to the decoding side. The first subset covers a DCcoefficient. The last subset covers the last non-zero coefficient. Thenon-zero subset flag indicates whether the subset contains non-zerocoefficients or not.

The entropy coding unit 170 entropy-codes the scanned component by thescanning unit 160, intra prediction information received from the intraprediction unit 120, motion information received from the interprediction unit 130, and so on.

The inverse quantization/transform unit 180 inversely quantizes thequantized coefficients of the quantized block, and inversely transformsthe inverse quantized block to generate residual signals.

The post-processing unit 190 performs a deblocking filtering process forremoving blocking artifact generated in a reconstructed picture.

The picture storing unit 195 receives post-processed image from thepost-processing unit 190, and stores the image in picture units. Apicture may be a frame or a field.

FIG. 2 is a flow chart illustrating a method of encoding video data inan inter prediction mode according to the present invention.

Motion information of a current block is determined (S110). The currentblock is a prediction unit. A size of the current block is determined bya size and a partitioning mode of the coding unit.

The motion information varies according to a prediction type. If theprediction type is a uni-directional prediction, the motion informationincludes a reference index specifying a picture of a reference list 0,and a motion vector. If the prediction type is a bi-directionalprediction, the motion information includes two reference indexesspecifying a picture of a reference list 0 and a picture of a referencelist 1, and a list 0 motion vector and a list 1 motion vector.

A prediction block of the current block is generated using the motioninformation (S120).

If the motion vector indicates an integer-pixel location, the predictionblock is generated by copying a block of the reference picture specifiedby the motion vector. If the motion vector indicates a sub-pixellocation, the prediction block is generated by interpolating the pixelsof the reference picture. The motion vector is given in quarter-pixelunits.

FIG. 3 is a conceptual diagram illustrating pixel positions indicated bya motion vector according to the present invention.

In FIG. 3, the pixels labeled with L0, R0, R1, L1, A0 and B0 are integerposition pixels of the reference picture and the pixels labeled witha_(L0) to r_(L0) at sub-pixel locations are fractional pixels to beinterpolated using an interpolation filter which is selected based onthe motion vector.

If a pixel to be interpolated is located at a sub-pixel location a_(L0),b_(L0) or c_(L0), the pixel labeled with a_(L0), b_(L0) or c_(L0) isgenerated by applying an interpolation filter to horizontally nearestinteger position pixels. If a pixel to be interpolated is located at asub-pixel location d_(L0), h_(L0) or n_(L0), the pixel labeled withd_(L0), h_(L0) or n_(L0) is generated by applying an interpolationfilter to vertically nearest integer position pixels. If a pixel to beinterpolated is located at a sub-pixel location e_(L0), i_(L0) orp_(L0), the pixel labeled with e_(L0), i_(L0) or p_(L0) is generated byapplying an interpolation filter to vertically nearest interpolatedpixels each of which includes a character ‘a’ within its label. If apixel to be interpolated is located at a sub-pixel location g_(L0),k_(L0) or r_(L0), the pixel labeled with g_(L0), k_(L0) or r_(L0) isgenerated by applying an interpolation filter to vertically nearestinterpolated pixels each of which includes a character ‘c’ within itslabel. If a pixel to be interpolated is located at a sub-pixel locationf_(L0), j_(L0) or q_(L0), the pixel labeled with f_(L0), j_(L0) orq_(L0) is generated by applying an interpolation filter to verticallyneighboring interpolated pixels each of which includes a character ‘c’within its label.

The interpolation filter is determined based on the sub-pixel locationof the pixel to be interpolated, or based on a prediction mode and asub-pixel location of the pixel to be interpolated.

Table 1 shows exemplary filters. The sub-pixel location H indicates ahalf-pixel location in interpolation direction. For example, thelocations b_(L0), h_(L0), i_(L0), j_(L0), and k_(L0) correspond to thesub-pixel location H. The sub-pixel locations FL and FR indicate aquarter-pixel location in interpolation direction. For example, thelocations a_(L0), d_(L0), e_(L0), f_(L0), and g_(L0) correspond to thesub-pixel location FL, and the locations c_(L0), n_(L0), p_(L0), q_(L0),and r_(L0) correspond to the sub-pixel location FR.

TABLE 1 Prediction Sub-Pixel mode Location Filter coefficientUni-directional H {2, −8, 36, 36, −8, 2} prediction FL {−3, 51, 20, −7,2} FR {2, −7, 20, 51, −3} Bi-directional H {−1, 4, −11, 40, 40, −11, 4,−1} prediction FL {−1, 4, −10, 57, 19, −7, 3, −1} FR {−1, 3, −7, 19, 57,−10, 4, −1}

As shown in Table 1, in uni-directional prediction, 6-tap symmetryfilter may be used to interpolate pixels of half-pixel location H, and5-tap asymmetry filter may be used to interpolate pixels ofquarter-pixel location FL or FR. In bi-directional prediction, 8-tapsymmetry filter may be used for the half-pixel location H and 8-tapasymmetry filter may be used for the quarter-pixel location FL and FR.

Alternatively, the filter may be determined by only the sub-pixellocation of the pixel to be interpolated. In uni-directional prediction,8-tap symmetry filter may be used to interpolate pixels of half-pixellocations and 7-tap asymmetry filter or 6-tap asymmetry filter may beused to interpolate pixels of quarter-pixel locations. In bi-directionalprediction, same filter or another filter having smaller number of tapsmay be used to interpolate pixels of sub-pixel locations.

A residual block is generated using the current block and the predictionblock (S130). The residual block has the same size of the transformunit. If the prediction unit is larger than the transform unit, theresidual signals between the current block and the prediction block areinto multiple residual blocks.

The residual block is encoded (S140). The residual block is encoded bythe transform unit 140, the quantization unit 150, the scanning unit 160and the entropy coding unit 170 of FIG. 1.

The motion information is encoded (S150). The motion information may beencoded predictively using spatial candidates and a temporal candidateof the current block. The motion information is encoded in a skip mode,a merge mode or an AMVP mode. In the skip mode, the prediction unit hasthe size of coding unit and the motion information is encoded using thesame method as that of the merge mode. In the merge mode, the motioninformation of the current prediction unit is equal to motioninformation of one candidate. In the AMVP mode, the motion vector of themotion information is predictively coded using one or more motion vectorcandidate.

FIG. 4 is a flow chart illustrating a method of encoding motioninformation in the merge mode according to the present invention.

Spatial merge candidates are derived (S210). FIG. 5 is a conceptualdiagram illustrating positions of spatial merge candidate blocksaccording to the present invention.

As shown in FIG. 5, the merge candidate block is a left block (block A),an above block (block B), an above-right block (block C), a left-belowblock (block D) or an above-left block (block E) of the current block.The blocks are prediction blocks. The above-left block (block E) is setas merge candidate block when one or more of the blocks A, B, C and Dare unavailable. The motion information of an available merge candidateblock N is set as a spatial merge candidate N. N is A, B, C, D or E.

The spatial merge candidate may be set as unavailable according to theshape of the current block and the position of the current block. Forexample, if the coding unit is split into two prediction units (block P0and block P1) using asymmetric partitioning, it is probable that themotion information of the block P0 is not equal to the motioninformation of the block P1. Therefore, if the current block is theasymmetric block P1, the block P0 is set as unavailable candidate blockas shown in FIGS. 6 to 9.

FIG. 6 is a conceptual diagram illustrating positions of spatial mergecandidate blocks in an asymmetric partitioning mode according to thepresent invention.

As shown in FIG. 6, a coding unit is partitioned into two asymmetricprediction blocks P0 and P1 and the partitioning mode is an nL×2N mode.The size of the block P0 is hN×2N and the size of the block P1 is(2−h)N×2N. The value of h is ½. The current block is the block P1. Theblocks A, B, C, D and E are spatial merge candidate blocks. The block P0is the spatial merge candidate block A.

In present invention, the spatial merge candidate A is set asunavailable not to be listed on the merge candidate list. Also, thespatial merge candidate block B, C, D or E having the same motioninformation of the spatial merge candidate block A is set asunavailable.

FIG. 7 is another conceptual diagram illustrating positions of spatialmerge candidate blocks in an asymmetric partitioning mode according tothe present invention.

As shown in FIG. 7, a coding unit is partitioned into two asymmetricprediction blocks P0 and P1 and the partitioning mode is an nR×2N mode.The size of the block P0 is (2−h)N×2N and the size of the block P1 ishN×2N. The value of h is ½. The current block is the block P1. Theblocks A, B, C, D and E are spatial merge candidate blocks. The block P0is the spatial merge candidate block A.

In present invention, the spatial merge candidate A is set asunavailable not to be listed on the merge candidate list. Also, thespatial merge candidate block B, C, D or E having the same motioninformation of the spatial merge candidate block A is set asunavailable.

FIG. 8 is another conceptual diagram illustrating positions of spatialmerge candidate blocks in another asymmetric partitioning mode accordingto the present invention.

As shown in FIG. 8, a coding unit is partitioned into two asymmetricprediction blocks P0 and P1 and the partitioning mode is a 2N×nU mode.The size of the block P0 is 2N×hN and the size of the block P1 is2N×(2−h)N. The value of h is ½. The current block is the block P1. Theblocks A, B, C, D and E are spatial merge candidate blocks. The block P0is the spatial merge candidate block B.

In present invention, the spatial merge candidate B is set asunavailable not to be listed on the merge candidate list. Also, thespatial merge candidate block C, D or E having the same motioninformation of the spatial merge candidate block B is set asunavailable.

FIG. 9 is another conceptual diagram illustrating positions of spatialmerge candidate blocks in another asymmetric partitioning mode accordingto the present invention.

As shown in FIG. 9, a coding unit is partitioned into two asymmetricprediction blocks P0 and P1 and the partitioning mode is a 2N×nD mode.The size of the block P0 is 2N×(2−h)N and the size of the block P1 is2N×hN. The value of h is ½. The current block is the block P1. Theblocks A, B, C, D and E are spatial merge candidate blocks. The block P0is the spatial merge candidate block B.

In present invention, the spatial merge candidate B is set asunavailable not to be listed on the merge candidate list. Also, thespatial merge candidate block C, D or E having the same motioninformation of the spatial merge candidate block B is set asunavailable.

The spatial merge candidate may also be set as unavailable based onmerge area. If the current block and the spatial merge candidate blockbelong to same merge area, the spatial merge candidate block is set asunavailable. The merge area is a unit area in which motion estimation isperformed and information specifying the merge area is included in a bitstream.

A temporal merge candidate is derived (S220). The temporal mergecandidate includes a reference picture index and a motion vector of thetemporal merge candidate.

The reference picture index of the temporal merge candidate may bederived using one or more reference picture indexes of neighboringblock. For example, one of the reference picture indexes of a leftneighboring block, an above neighboring block and a corner neighboringblock is set as the reference picture index of the temporal mergecandidate. The corner neighboring block is one of an above-rightneighboring block, a left-below neighboring block and an above-leftneighboring block. Alternatively, the reference picture index of thetemporal merge candidate may be set to zero to reduce the complexity.

The motion vector of the temporal merge candidate may be derived asfollows.

First, a temporal merge candidate picture is determined. The temporalmerge candidate picture includes a temporal merge candidate block. Onetemporal merge candidate picture is used within a slice. A referencepicture index of the temporal merge candidate picture may be set tozero.

If the current slice is a P slice, one of the reference pictures of thereference picture list 0 is set as the temporal merge candidate picture.If the current slice is a B slice, one of the reference pictures of thereference picture lists 0 and 1 is set as the temporal merge candidatepicture. A list indicator specifying whether the temporal mergecandidate picture belongs to the reference picture lists 0 or 1 isincluded in a slice header if the current slice is a B slice. Thereference picture index specifying the temporal merge candidate picturemay be included in the slice header.

Next, the temporal merge candidate block is determined. FIG. 10 is aconceptual diagram illustrating position of temporal merge candidateblock according to the present invention. As shown in FIG. 10, a firstcandidate block may be a right-below corner block (block H) of the blockC. The block C has same size and same location of the current block andis located within the temporal merge candidate picture. A secondcandidate block is a block covering an upper-left pixel of the center ofthe block C.

The temporal merge candidate block may be the first candidate block orthe second candidate block. If the first candidate block is available,the first candidate block is set as the temporal merge candidate block.If the first candidate block is unavailable, the second candidate blockis set as the temporal merge candidate block. If the second candidateblock is unavailable, the temporal merge candidate block is set asunavailable.

The temporal merge candidate block is determined based on the positionof the current block. For example, if the current block is adjacent to alower LCU (that is, if the first candidate block belongs to a lowerLCU), the first candidate block may be changed into a block within acurrent LCU or is set as unavailable.

Also, the first and second candidate blocks may be changed into anotherblock based on each position of the candidate block within a motionvector storing unit. The motion vector storing unit is a basic unitstoring motion information of reference pictures.

FIG. 11 is a conceptual diagram illustrating a method of storing motioninformation according to the present invention. As shown in FIG. 11, themotion storing unit may be a 16×16 block. The motion vector storing unitmay be divided into sixteen 4×4 bocks. If the motion vector storing unitis a 16×16 block, the motion information is stored per the motion vectorstoring unit. If the motion vector storing unit includes multipleprediction units of reference picture, motion information of apredetermined prediction unit of the multiple prediction units is storedin memory to reduce amount of motion information to be stored in memory.The predetermined prediction unit may be a block covering one of thesixteen 4×4 blocks. The predetermined prediction unit may be a blockcovering a block C3, a block BR. Or the predetermined prediction unitmay be a block covering a block UL.

Therefore, if the candidate block does not include the predeterminedblock, the candidate block is changed into a block including thepredetermined block.

If the temporal merge candidate block is determined, the motion vectorof the temporal merge candidate block is set as the motion vector of thetemporal merge candidate.

A merge candidate list is constructed (S230). The available spatialcandidates and the available temporal candidate are listed in apredetermined order. The spatial merge candidates are listed up to fourin the order of A, B, C, D and E. The temporal merge candidate may belisted between B and C or after the spatial candidates.

It is determined whether one or more merge candidates are generated ornot (S240). The determination is performed by comparing the number ofmerge candidates listed in the merge candidate list with a predeterminednumber of the merge candidates. The predetermined number may bedetermined per picture or slice.

If the number of merge candidates listed in the merge candidate list issmaller than a predetermined number of the merge candidates, one or moremerge candidates are generated (S250). The generated merge candidate islisted after the last available merge candidate.

If the number of available merge candidates is equal to or greater than2, one of two available merge candidates has list 0 motion informationand the other has list 1 motion information, the merge candidate may begenerated by combining the list 0 motion information and the list 1motion information. Multiple merge candidates may be generated if thereare multiple combinations.

One or more zero merge candidates may be added to the list. If the slicetype is P, the zero merge candidate has only list 0 motion information.If the slice type is B, the zero merge candidate has list 0 motioninformation and list 1 motion information.

A merge predictor is selected among the merge candidates of the mergelist, a merge index specifying the merge predictor is encoded (S260).

FIG. 12 is a block diagram of an image decoding apparatus 200 accordingto the present invention.

The image decoding apparatus 200 according to the present inventionincludes an entropy decoding unit 210, an inverse scanning unit 220, aninverse quantization unit 230, an inverse transform unit 240, an intraprediction unit 250, an inter prediction unit 260, a post-processingunit 270, a picture storing unit 280 and an adder 290.

The entropy decoding unit 210 extracts the intra prediction information,the inter prediction information and the quantized coefficientcomponents from a received bit stream using a context-adaptive binaryarithmetic decoding method.

The inverse scanning unit 220 applies an inverse scan pattern to thequantized coefficient components to generate quantized block. In interprediction, the inverse scan pattern is a diagonal scan. The quantizedcoefficient components include the significant flags, the coefficientsigns and the coefficients levels.

When the size of the transform unit is larger than the a predeterminedsize, the significant flags, the coefficient signs and the coefficientslevels are inversely scanned in the unit of subset using the diagonalscan to generate subsets, and the subsets are inversely scanned usingthe diagonal scan to generate the quantized block. The predeterminedsize is equal to the size of the subset. The subset is a 4×4 blockincluding 16 transform coefficients. The significant flags, thecoefficient signs and the coefficient levels are inversely scanned inthe reverse direction. The subsets are also inversely scanned in thereverse direction.

A parameter indicating last non-zero coefficient position and thenon-zero subset flags are extracted from the bit stream. The number ofencoded subsets is determined based on the parameter indicating lastnon-zero coefficient position. The non-zero subset flag is used todetermine whether the corresponding subset has at least one non-zerocoefficient. If the non-zero subset flag is equal to 1, the subset isgenerated using the diagonal scan. The first subset and the last subsetare generated using the inverse scan pattern.

The inverse quantization unit 230 receives the differential quantizationparameter from the entropy decoding unit 210 and generates thequantization parameter predictor to generate the quantization parameterof the coding unit. The operation of generating the quantizationparameter predictor is the same as the operation of the quantizationunit 150 of FIG. 1. Then, the quantization parameter of the currentcoding unit is generated by adding the differential quantizationparameter and the quantization parameter predictor. If the differentialquantization parameter for the current coding unit is not transmittedfrom an encoding side, the differential quantization parameter is set tozero.

The inverse quantization unit 230 inversely quantizes the quantizedblock.

The inverse transform unit 240 inversely transforms theinverse-quantized block to generate a residual block. An inversetransform matrix is adaptively determined according to the predictionmode and the size of the transform unit. The inverse transform matrix isa DCT-based integer transform matrix or a DST-based integer transformmatrix. In inter prediction, the DCT-based integer transforms are used.

The intra prediction unit 250 derives an intra prediction mode of acurrent prediction unit using the received intra prediction information,and generates a prediction block according to the derived intraprediction mode.

The inter prediction unit 260 derives the motion information of thecurrent prediction unit using the received inter prediction information,and generates a prediction block using the motion information.

The post-processing unit 270 operates the same as the post-processingunit 180 of FIG. 1.

The picture storing unit 280 receives post-processed image from thepost-processing unit 270, and stores the image in picture units. Apicture may be a frame or a field.

The adder 290 adds the restored residual block and a prediction block togenerate a reconstructed block.

FIG. 13 is a flow chart illustrating a method of decoding an image ininter prediction mode according to the present invention.

Motion information of a current block is derived (S310). The currentblock is a prediction unit. A size of the current block is determined bythe size of the coding unit and the partitioning mode.

The motion information varies according to a prediction type. If theprediction type is a uni-directional prediction, the motion informationincludes a reference index specifying a picture of a reference list 0,and a motion vector. If the prediction type is a bi-directionalprediction, the motion information includes a reference index specifyinga picture of a reference list 0, a reference index specifying a pictureof a reference list 1, and a list 0 motion vector and a list 1 motionvector.

The motion information is adaptively decoded according the coding modeof the motion information. The coding mode of the motion information isdetermined by a skip flag and a merge flag. If the skip flag is equal to1, the merge flag does not exist and the coding mode is a skip mode. Ifthe skip flag is equal to 0 and the merge flag is equal to 1, the codingmode is a merge mode. If the skip flag and the merge flag are equal to0, the coding mode is an AMVP mode.

A prediction block of the current block is generated using the motioninformation (S320).

If the motion vector indicates an integer-pixel location, the predictionblock is generated by copying a block of the reference picture specifiedby the motion vector. If the motion vector indicates a sub-pixellocation, the prediction block is generated by interpolating the pixelsof the reference picture. The motion vector is given in quarter-pixelunits.

As shown in FIG. 3, the pixels labeled with L0, R0, R1, L1, A0 and B0are integer position pixels of the reference picture and the pixelslabeled with a_(L0) to r_(L0) at sub-pixel locations are fractionalpixels to be interpolated using an interpolation filter which isselected based on the motion vector.

If a pixel to be interpolated is located at a sub-pixel location a_(L0),b_(L0) or c_(L0), the pixel labeled with a_(L0), b_(L0) or c_(L0) isgenerated by applying an interpolation filter to horizontally nearestinteger position pixels. If a pixel to be interpolated is located at asub-pixel location d_(L0), h_(L0) or n_(L0), the pixel labeled withd_(L0), h_(L0) or n_(L0) is generated by applying an interpolationfilter to vertically nearest integer position pixels. If a pixel to beinterpolated is located at a sub-pixel location e_(L0), i_(L0) orp_(L0), the pixel labeled with e_(L0), i_(L0) or p_(L0) is generated byapplying an interpolation filter to vertically nearest interpolatedpixels each of which includes a character ‘a’ within its label. If apixel to be interpolated is located at a sub-pixel location g_(L0),k_(L0) or r_(L0), the pixel labeled with g_(L0), k_(L0) or r_(L0) isgenerated by applying an interpolation filter to vertically nearestinterpolated pixels each of which includes a character ‘c’ within itslabel. If a pixel to be interpolated is located at a sub-pixel locationf_(L0), j_(L0) or q_(L0), the pixel labeled with f_(L0), j_(L0) orq_(L0) is generated by applying an interpolation filter to verticallyneighboring interpolated pixels each of which includes a character ‘c’within its label.

The interpolation filter is determined based on the sub-pixel locationof the pixel to be interpolated, or based on a prediction mode and asub-pixel location of the pixel to be interpolated.

As shown in Table 1, in uni-directional prediction, 6-tap symmetryfilter may be used to interpolate pixels of half-pixel location H, and5-tap asymmetry filter may be used to interpolate pixels ofquarter-pixel location FL or FR. In bi-directional prediction, 8-tapsymmetry filter may be used for the half-pixel location H and 8-tapasymmetry filter may be used for the quarter-pixel location FL and FR.

Alternatively, the filter may be determined by only the sub-pixellocation of the pixel to be interpolated. In uni-directional prediction,8-tap symmetry filter may be used to interpolate pixels of half-pixellocations and 7-tap asymmetry filter or 6-tap may be used to interpolatepixels of quarter-pixel locations. In bi-directional prediction, samefilter or another filter having smaller number of taps may be used tointerpolate pixels of sub-pixel locations.

A residual block is generated (S330). The residual block is generated bythe entropy decoding unit 210, the inverse scanning unit 220, theinverse quantization unit 230 and the inverse transform unit 240 of FIG.12.

A reconstructed block is generated using the prediction block and theresidual block (S340).

The prediction block has the same size of the prediction unit, and theresidual block has the same size of the transform unit. Therefore, theresidual signals and the prediction signals of same size are added togenerate reconstructed signals.

FIG. 14 is a flow chart illustrating a method of deriving motioninformation in merge mode.

A merge index is extracted from a bit stream (S410). If the merge indexdoes not exist, the number of merge candidates is set to one.

Spatial merge candidates are derived (S420). The available spatial mergecandidates are the same as describe in S210 of FIG. 4.

A temporal merge candidate is derived (S430). The temporal mergecandidate includes a reference picture index and a motion vector of thetemporal merge candidate. The reference index and the motion vector ofthe temporal merge candidate are the same as described in S220 of FIG.4.

A merge candidate list is constructed (S440). The merge list is the sameas described in S230 of FIG. 4.

It is determined whether one or more merge candidates are generated ornot (S450). The determination is performed by comparing the number ofmerge candidates listed in the merge candidate list with a predeterminednumber of the merge candidates. The predetermined number is determinedper picture or slice.

If the number of merge candidates listed in the merge candidate list issmaller than a predetermined number of the merge candidates, one or moremerge candidates are generated (S460). The generated merge candidate islisted after the last available merge candidate. The merge candidate isgenerated as the same method described in S250 of FIG. 4.

The merge candidate specified by the merge index is set as the motioninformation of the current block (S470).

FIG. 15 is a flow chart illustrating a procedure of generating aresidual block in inter prediction mode according to the presentinvention.

Quantized coefficient components are generated by the entropy decodingunit (S510).

A quantized block is generated by inversely scanning the quantizedcoefficient components according to the diagonal scan (S520). Thequantized coefficient components include the significant flags, thecoefficient signs and the coefficients levels.

When the size of the transform unit is larger than the a predeterminedsize, the significant flags, the coefficient signs and the coefficientslevels are inversely scanned in the unit of subset using the diagonalscan to generate subsets, and the subsets are inversely scanned usingthe diagonal scan to generate the quantized block. The predeterminedsize is equal to the size of the subset. The subset is a 4×4 blockincluding 16 transform coefficients. The significant flags, thecoefficient signs and the coefficient levels are inversely scanned inthe reverse direction. The subsets are also inversely scanned in thereverse direction.

The parameter indicating last non-zero coefficient position and thenon-zero subset flags are extracted from the bit stream. The number ofencoded subsets is determined based on the parameter indicating lastnon-zero coefficient position. The non-zero subset flags are used todetermine whether the subset has at least one non-zero coefficient. Ifthe non-zero subset flag is equal to 1, the subset is generated usingthe diagonal scan. The first subset and the last subset are generatedusing the inverse scan pattern.

The quantized block is inversely quantized using an inverse quantizationmatrix and a quantization parameter (S530).

A minimum size of quantization unit is determined. A parametercu_qp_delta_enabled_info specifying the minimum size is extracted from abit stream, and the minimum size of the quantization unit is determinedby the following equation.Log 2(MinQUSize)=Log 2(MaxCUSize)−cu_qp_delta_enabled_info

The MinQUSize indicates the minimum size of the quantization unit, theMaxCUSize indicates the size of LCU. The parametercu_qp_delta_enabled_info is extracted from a picture parameter set.

A differential quantization parameter of the current coding unit isderived. The differential quantization parameter is included perquantization unit. Therefore, if the size of the current coding unit isequal to or larger than the minimum size of the quantization unit, thedifferential quantization parameter for the current coding unit isrestored. If the differential quantization parameter does not exist, thedifferential quantization parameter is set to zero. If multiple codingunits belong to a quantization unit, the first coding unit containing atleast one non-zero coefficient in the decoding order contains thedifferential quantization unit.

A coded differential quantization parameter is arithmetically decoded togenerate bin string indicating the absolute value of the differentialquantization parameter and a bin indicating the sign of the differentialquantization parameter. The bin string may be a truncated unary code. Ifthe absolute value of the differential quantization parameter is zero,the bin indicating the sign does not exist. The differentialquantization parameter is derived using the bin string indicating theabsolute value and the bin indicating the sign.

A quantization parameter predictor of the current coding unit isderived. The quantization parameter predictor is generated by usingquantization parameters of neighboring coding units and quantizationparameter of previous coding unit as follows.

A left quantization parameter, an above quantization parameter and aprevious quantization parameter are sequentially retrieved in thisorder. An average of the first two available quantization parametersretrieved in that order is set as the quantization parameter predictorwhen two or more quantization parameters are available, and when onlyone quantization parameter is available, the available quantizationparameter is set as the quantization parameter predictor. That is, ifthe left and above quantization parameter are available, the average ofthe left and above quantization parameter is set as the quantizationparameter predictor. If only one of the left and above quantizationparameter is available, the average of the available quantizationparameter and the previous quantization parameter is set as thequantization parameter predictor. If both of the left and abovequantization parameter are unavailable, the previous quantizationparameter is set as the quantization parameter predictor.

If multiple coding units belong to a quantization unit of minimum size,the quantization parameter predictor for the first coding unit indecoding order is derived and used for the other coding units.

The quantization parameter of the current coding unit is generated usingthe differential quantization parameter and the quantization parameterpredictor.

A residual block is generated by inverse-transforming theinverse-quantized block (S540). One dimensional horizontal and verticalinverse DCT based-transforms are used.

While the invention has been shown and described with reference tocertain exemplary embodiments thereof, it will be understood by thoseskilled in the art that various changes in form and details may be madetherein without departing from the spirit and scope of the invention asdefined by the appended claims.

What is claimed is:
 1. A method of decoding video data inuni-directional prediction by a decoding apparatus, the methodcomprising: deriving, by the decoding apparatus, a reference pictureindex and a motion vector of a current prediction unit; generating, bythe decoding apparatus, a prediction block of the current predictionunit using the reference picture index and the motion vector;generating, by the decoding apparatus, a quantized block by inverselyscanning quantized coefficient components; generating, by the decodingapparatus, a transformed block by inversely quantizing the quantizedblock using a quantization parameter; generating, by the decodingapparatus, a residual block by inversely transforming the transformedblock; and generating, by the decoding apparatus, reconstructed pixelsusing the prediction block and the residual block, wherein predictionpixels of the prediction block are generated using an interpolationfilter selected based on the motion vector where the number of taps ofthe interpolation filter is determined by the prediction pixel positionindicated by the motion vector, the interpolation filter being a 7-tapfilter if the motion vector indicates a quarter pixel position, theinterpolation filter being an 8-tap filter if the motion vectorindicates a half pixel position, wherein the quantization parameter isderived by adding a differential quantization parameter and aquantization parameter predictor, when only one of a left quantizationparameter and an above quantization parameter is available, thequantization parameter predictor is an average of a previousquantization parameter and the available one of the left quantizationparameter and the above quantization parameter, and when both of theleft quantization parameter and the above quantization parameter areunavailable, the previous quantization parameter is set as thequantization parameter predictor, wherein the differential quantizationparameter is restored using a bin string indicating an absolute value ofthe differential quantization parameter and a bin indicating a sign ofthe differential quantization parameter, and wherein the quantizationparameter is derived per quantization unit, and a size of thequantization unit is one of allowable sizes of a coding unit.
 2. Themethod of claim 1, wherein the reference picture index of the currentprediction unit is a reference picture index of a spatial or temporalmerge candidate specified by a merge index and the motion vector of thecurrent prediction unit is a motion vector of the spatial or temporalmerge candidate specified by the merge index, and if the currentprediction unit is a second prediction unit partitioned by asymmetricpartitioning, the spatial merge candidate corresponding to a firstprediction unit partitioned by the asymmetric partitioning is set asunavailable.
 3. The method of claim 2, wherein if a size of the currentprediction unit is (3/2)N×2N, the left spatial merge candidate is set asunavailable.
 4. The method of claim 2, wherein a motion vector of thetemporal merge candidate is a motion vector of a temporal mergecandidate block within a temporal merge candidate picture, and aposition of the temporal merge candidate block is determined dependingon a position of the current block within a largest coding unit (LCU).5. A method of encoding video data in uni-directional prediction by anencoding apparatus, the method comprising: determining, by the encodingapparatus, a reference picture index and a motion vector of a currentprediction unit; generating, by the encoding apparatus, a predictionblock with the reference picture index and the motion vector;generating, by the encoding apparatus, a residual block with theprediction block; generating, by the encoding apparatus, a transformedblock by transforming the residual block; generating, by the encodingapparatus, a quantized block by quantizing the transformed block using aquantization parameter; and generating, by the encoding apparatus,quantized coefficient components by scanning the quantized block,wherein prediction pixels of the prediction block are generated using aninterpolation filter selected based on the motion vector where thenumber of taps of the interpolation filter is determined by theprediction pixel position indicated by the motion vector, theinterpolation filter being a 7-tap filter if the motion vector indicatesa quarter pixel position, the interpolation filter being an 8-tap filterif the motion vector indicates a half pixel position, wherein thequantization parameter is derived per quantization unit, and a size ofthe quantization unit is one of allowable sizes of a coding unit,wherein a differential quantization parameter is generated bysubtracting a quantization parameter predictor from the quantizationparameter, when only one of a left quantization parameter and an abovequantization parameter is available, the quantization parameterpredictor is an average of a previous quantization parameter and theavailable one of the left quantization parameter and the abovequantization parameter, and when both of the left quantization parameterand the above quantization parameter are unavailable, the previousquantization parameter is set as the quantization parameter predictor,and wherein the differential quantization parameter is encoded into abin string indicating an absolute value of the differential quantizationparameter and a bin indicating a sign of the differential quantizationparameter.
 6. The method of claim 5, wherein the reference picture indexis a reference picture index of a spatial or temporal merge candidatespecified by a merge index and the motion vector is a motion vector ofthe spatial or temporal merge candidate specified by the merge index,and if the current prediction unit is a second prediction unitpartitioned by asymmetric partitioning, the spatial merge candidatecorresponding to a first prediction unit partitioned by the asymmetricpartitioning is set as unavailable.
 7. The method of claim 6, wherein ifa size of the current prediction unit is (3/2)N×2N, the left spatialmerge candidate is set as unavailable.
 8. The method of claim 6, whereina motion vector of the temporal merge candidate is a motion vector of atemporal merge candidate block within a temporal merge candidatepicture, and a position of the temporal merge candidate block isdetermined depending on a position of the current block within a largestcoding unit (LCU).
 9. A non-transitory computer-readable storage mediumstoring encoded video information, comprising: a bit stream stored inthe computer-readable storage medium, the bit stream comprisingentropy-encoded information on a reference picture index, a motionvector and a quantized coefficients, wherein the quantized coefficientsis generated by quantizing a transformed residual block using aquantization parameter, and the transformed residual block is generatedby transforming a residual block which is generated based on aprediction block, and the prediction block is generated using thereference picture index and the motion vector, wherein prediction pixelsof the prediction block are generated using an interpolation filterselected based on the motion vector where the number of taps of theinterpolation filter is determined by the prediction pixel positionindicated by the motion vector, the interpolation filter being a 7-tapfilter if the motion vector indicates a quarter pixel position, theinterpolation filter being an 8-tap filter if the motion vectorindicates a half pixel position, wherein the quantization parameter isderived per quantization unit, and a size of the quantization unit isone of allowable sizes of a coding unit, wherein a differentialquantization parameter is generated by subtracting a quantizationparameter predictor from the quantization parameter, when only one of aleft quantization parameter and an above quantization parameter isavailable, the quantization parameter predictor is an average of aprevious quantization parameter and the available one of the leftquantization parameter and the above quantization parameter, and whenboth of the left quantization parameter and the above quantizationparameter are unavailable, the previous quantization parameter is set asthe quantization parameter predictor, and wherein the differentialquantization parameter is encoded into a bin string indicating anabsolute value of the differential quantization parameter and a binindicating a sign of the differential quantization parameter.